package lab02.text23;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

public class Text {
    public static void main(String[] args) throws ParseException {
        String birthday;

        Scanner scanner=new Scanner(System.in);
        System.out.println("please input your birthday:");
        //接受字符串nextLine
        birthday=scanner.nextLine();

        //定义日期怎么表达 SimpleDateFormat
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-mm-dd");

        //生日多少天
        //关于日期的计算calendar
        Calendar calendar=Calendar.getInstance();

        calendar.setTime(sdf.parse(birthday));
        long time1=calendar.getTimeInMillis();//把日期化为整型long

        calendar.setTime(sdf.parse("2017-11-02"));
        long time2=calendar.getTimeInMillis();

        System.out.println("天数："+(time1-time2)/(24*60*60*1000));

        //time1生日
        // time2 当前日期
        // 1秒=1000毫秒  time1-time2算出来为毫秒
        // (time1-time2)/(24*60*60*1000)

    }
}